#!/usr/bin/perl -w
use strict;

use DBI;
our $h=DBI->connect('DBI:mysql:database=Down','root','') || die $DBI::errstr;

our $ns=$h->prepare(qq/insert into down (url) values (?)/);
while (<>)
{
chomp;

s{^.*http://cdit(?:|\:\d+)/(ubuntu/\S+\.u?deb).*$}{http://archive.ubuntu.com/$1};
s{^/?ubuntu/|^http://cdit(?:|\:\d+)/ubuntu/}{http://archive.ubuntu.com/ubuntu/};
s{^pool/}{http://archive.ubuntu.com/ubuntu/pool/};

$ns->execute($_);
}